
unsigned char EthernetMPCP[73];
unsigned char LLID_addr[2] = {0,16};//ONU 
unsigned char OLT_MACAddr[6] = {0x00,0x26,0x82,0x21,0x36,0x8C};//OLT
unsigned char ONU_MACAddr[6] = {0x10,0x02,0x03,0x04,0x05,0x06};//ONU
/**************************************************************************************************
             <0>  0 - buffer empty
                  1 - buffer ready
             <1>  - no of q set
             <2>  - report bit map
             <3>  - Q#1 byte 1
             <4>  - Q#1 byte 2
             <5>  - Q#2 byte 1
             <6>  - Q#2 byte 2
             <7>  - Q#3 byte 1
             <8>  - Q#3 byte 2
             <9>  - report bit map
             <10> - Q#1 byte 1
             <11> - Q#1 byte 2
             <12> - Q#2 byte 1
             <13> - Q#2 byte 2
             <14> - Q#3 byte 1
             <15> - Q#3 byte 2
***************************************************************************************************/
unsigned char queue_list[26] ={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};//ONU 
/**************************************************************************************************
grand list format <0> 0 - no grants
                      1 - grants ready
                      2 - grant process
                      3 - grant send
                  <1> - number of grants
         <2><3><4><5> - grant#1 start time
               <6><7> - grant#1 length
       <8><9><10><11> - grant#2 start time
             <12><13> - grant#2 length
     <14><15><16><17> - grant#3 start time
             <18><19> - grant#3 length
     <20><21><22><23> - grant#4 start time
             <24><25> - grant#4 length
***************************************************************************************************/
unsigned char grants_list[26] ={0,1,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0};//ONU
//long int grants_list[10] ={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0};//ONU

unsigned long int timer_counter32;
unsigned int wdt_ctr = 0;
unsigned int in_ctr1 = 0;
unsigned int in_ctr2 = 0;
unsigned char in1_buffer[1530];
unsigned char in2_buffer[1530];
unsigned int length_type = 0x0000;
unsigned char URX1_Ready = 0 ;
unsigned char URX2_Ready = 0 ;




//Define
#define SPD  0x02
#define Reserved  0x55
#define SLD  0xD5


#define wdt_led  PORTDbits.RD0





//function decleration
void init_timer1(void);
void init_uart1(void);
void init_uart2(void);
void buffer_clr(void);
void wdt_(void);
void SChar(unsigned char in);


//external function decleration
extern void process_URX1(void);
extern void process_URX2(void);
extern void chk_report_buffer(void);
extern void send_1st_report(void);
extern void chk_report_buffer(void);
